#ifndef _CLIST_H_
#define _CLIST_H_


#include <stdlib.h>

typedef struct clist_node {
	void *data;
	struct clist_node *next;
}clist_node_t;

typedef struct clist {
	int				size;
	int				(*match)(const void *key1, const void *key2);
	void			(*destroy)(void *data);
	clist_node_t 	*head;
}clist_t;


void clist_init(clist_t *clist, void (*destroy)(void *data));
void clist_destroy(clist_t *clist);
int clist_insert_next(clist_t *clist, clist_node_t *l, void *data);
int clist_remove_next(clist_t *clist, clist_node_t *l, void **data);


#define clist_size(clist)		((clist)->size)
#define clist_head(clist)		((clist)->head)
#define clist_data(n)			((n)->data)
#define clist_next(n)			((n)->next)


#endif /*_CLIST_H_*/

